package com.kizuki.enums;

import org.junit.Test;

import java.util.Arrays;
import java.util.List;

public class TestEnum {

    @Test
    public void test(){
//        new Season(); // 枚举不能new生成
        Season spring = Season.valueOf(Season.class, "SPRING");
        System.out.println(Season.SPRING == spring); // true
        System.out.println(Season.SPRING.getClass() == Season.class); // true

        // api
        System.out.println(Season.SPRING.name());
        System.out.println(Season.SUMMER.ordinal());
        System.out.println(Season.SPRING.compareTo(Season.FALL));

        List<Season> seasons = Arrays.asList(Season.values()); // values获取数组
        System.out.println(seasons);
    }

}
